{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-05-16T02:54:53.030930Z",
     "start_time": "2024-05-16T02:54:50.469494Z"
    }
   },
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T02:55:46.443258Z",
     "start_time": "2024-05-16T02:55:46.414080Z"
    }
   },
   "cell_type": "code",
   "source": [
    "s1 = pd.Series([1,2,3], index=[\"a\", \"b\", \"c\"])\n",
    "s2 = pd.Series([1,2,3,4], index=[\"a\", \"b\", \"c\", \"d\"])\n",
    "s1+s2"
   ],
   "id": "25d4cc1b09ed5908",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    2.0\n",
       "b    4.0\n",
       "c    6.0\n",
       "d    NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 2
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T03:01:12.018766Z",
     "start_time": "2024-05-16T03:01:11.991111Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df1 = pd.DataFrame(np.arange(4).reshape(2,2), index=[\"a\", \"b\"], columns=[\"BJ\", \"SH\"])\n",
    "df2 = pd.DataFrame(np.arange(9).reshape(3,3), index=[\"a\", \"b\", \"c\"], columns=[\"BJ\", \"SH\", \"GZ\"])\n",
    "df1+df2"
   ],
   "id": "52aa2c15305a7a64",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    BJ  GZ   SH\n",
       "a  0.0 NaN  2.0\n",
       "b  5.0 NaN  7.0\n",
       "c  NaN NaN  NaN"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>BJ</th>\n",
       "      <th>GZ</th>\n",
       "      <th>SH</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 16
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T03:01:16.791651Z",
     "start_time": "2024-05-16T03:01:16.776997Z"
    }
   },
   "cell_type": "code",
   "source": "df1.sum()",
   "id": "4d6a0373f8df49a4",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "BJ    2\n",
       "SH    4\n",
       "dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 17
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T03:01:27.912454Z",
     "start_time": "2024-05-16T03:01:27.896446Z"
    }
   },
   "cell_type": "code",
   "source": "df1.sum(axis=1)",
   "id": "8f88403c25bba9cf",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    5\n",
       "dtype: int64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 18
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "aac40a6f76ff501f"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
